#include <stdio.h>
#include <stdlib.h>
#define LENGTH sizeof(arr)/sizeof(arr[0])
void Bubble_Sort(int *arr,int length)
{
    int temp;
    for(int i=0;i<length-1;i++)
    {
        for(int j=0;j<length-1-i;j++)
        {
            if(arr[j]>arr[j+1])
            {
                temp=arr[j];
                arr[j]=arr[j+1];
                arr[j+1]=temp;
            }
        }
    }
}
void Quick_Sort(int *arr,int low,int high);
void Quick_Sort(int *arr,int low,int high)
{
    int i=low-1;
    int pivot=arr[high];
    for(int j=low;j<high;j++)
    {
        if(arr[j]<=pivot)
        {
            i++;
            int temp=arr[i];
            arr[i]=arr[j];
            arr[j]=temp;
        }
    }
    int temp=arr[i+1];
    arr[i+1]=arr[high];
    arr[high]=temp;
    if(high<=low)
    {
        return;
    }
    Quick_Sort(arr,low,i);
    Quick_Sort(arr,i+1,high);
}
void Insert_Sort(float *arr,int length);
void Insert_Sort(float *arr,int length)
{
    float temp;
    for(int i=1;i<length;i++)
    {
        temp=arr[i];
        int j=i-1;
        while(j>=0&&arr[j]>temp)
        {
            arr[j+1]=arr[j];
            j--;
        }
        arr[j+1]=temp;
    }
}
void ChooseSort(int *arr,int length);
void ChooseSort(int *arr,int length)
{
    int *a=arr,*b=arr;
    int temp;
    for(int i=0;i<length-1;i++)
    {
        for(int j=i;j<length-1;j++)
        {
            if(*a>arr[j])
            {
                a=arr+j;
            }
        }
        temp=*a;
        *a=*b;
        *b=temp;
        b++;
        a=b;
    }
}
int main() 
{
    int arr[]={3,4,1,0,2,8,6};
    ChooseSort(arr,LENGTH);
    for(int i=0;i<LENGTH;i++)
    {
        printf("%d ",arr[i]);
    }
}
